package com.muse.nacos.consumer.controller;

import javax.annotation.Resource;

import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.muse.nacos.consumer.feign.server.ProviderService;
import com.muse.nacos.provider.sdk.OrderService;

import lombok.extern.slf4j.Slf4j;

/**
 * @description
 * @author: muse
 * @create: 2021-08-08 21:39
 **/
@Slf4j
@RequestMapping("/consumer")
@RestController
public class ConsumerController {

    @Reference // org.apache.dubbo.config.annotation
    private OrderService orderService;

    @Resource
    private ProviderService providerService;

    @RequestMapping("/hello")
    public String hello() {
        log.info("Feign invoke!");
        return providerService.hello();
    }

    @RequestMapping("/getOrder")
    public String getOrder() {
        log.info("getOrder invoke!");
        return orderService.getOrder();
    }
}
